package de.test.NeutrinoAndroidRemote;

import de.test.NeutrinoAndroidRemote.UI.ManualInput;
import de.test.NeutrinoAndroidRemote.UI.SwitchChannel;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainApplication extends Activity {
	public static final String PREFS_NAME = "NeutrinoAndroidRemotePrefs";

	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Button buttonManual = (Button)findViewById(R.id.buttonManual);
        buttonManual.setOnClickListener(listenerManualInput);
        
        Button buttonSwitchChannel = (Button)findViewById(R.id.buttonSwitchChannel);
        buttonSwitchChannel.setOnClickListener(listenerSwitchChannel);
        
        SharedPreferences settings = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
        SharedPreferences.Editor editor = settings.edit();
        editor.putString("ipAddress", "192.168.2.105");
        // Commit the edits!
        editor.commit();


        
    }
    
    // Create an anonymous implementation of OnClickListener
    private OnClickListener listenerManualInput = new OnClickListener() {
        public void onClick(View v) {
        	Intent IntentManualInput = new Intent(v.getContext(), ManualInput.class);
            startActivityForResult(IntentManualInput, 0);
        }
    };
    
    // Create an anonymous implementation of OnClickListener
    private OnClickListener listenerSwitchChannel = new OnClickListener() {
        public void onClick(View v) {
        	Intent IntentSwitchChannel = new Intent(v.getContext(), SwitchChannel.class);
            startActivityForResult(IntentSwitchChannel, 0);
        }
    };
}